package mobile.game.core.support.tuple;

import java.io.IOException;

import mobile.game.core.InputStream;
import mobile.game.core.OutputStream;
import mobile.game.core.interfaces.ISerilizable;

/**
 * @author g
 *
 * 3元组
 * @param <A>
 * @param <B>
 * @param <C>
 */
public class ThreeTuple<A, B, C> extends TwoTuple<A, B> {
	public final C third;

	public ThreeTuple(A first, B second, C third) {
		super(first, second);
		this.third = third;
	}

	@Override
	public void writeTo(OutputStream out) throws IOException {
		super.writeTo(out);
		out.write(third);
	}

	@Override
	public void readFrom(InputStream in) throws IOException {

	}	

	public static ISerilizable create(InputStream in) throws IOException {
		return new ThreeTuple<>(in.read(), in.read(), in.read());
	}

}
